e-cology系统里一个jsp页面通常需要包含什么内容
- 相关的操作的类、JSP标签、样式、脚本等
- 右键菜单
- 多语言标签
- 操作权限
<%@ page language="java" contentType="text/html; charset=UTF-8" %><!--指定页面编码-->
<%@ page import="weaver.general.Util,weaver.hrm.common.*,weaver.conn.*" %><!--引入相关的类-->
<%@ page import="weaver.file.*,net.sf.json.*,java.util.*,java.text.*,weaver.common.DataBook" %>
<%@ include file="/systeminfo/init_wev8.jsp" %><!--引入系统页面,用于判断是否登录,以及获取user对象-->
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea"%><!--引入系统标签-->
<%@ taglib uri="/browserTag" prefix="brow"%><!--引入浏览按钮标签-->
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="strUtil" class="weaver.common.StringUtil" scope="page" />
<jsp:useBean id="dateUtil" class="weaver.common.DateUtil" scope="page" />
<jsp:useBean id="enumUtil" class="weaver.common.EnumUtil" scope="page" />
<jsp:useBean id="detachCommonInfo" class="weaver.hrm.moduledetach.ManageDetachComInfo" scope="page" />
<jsp:useBean id="xssUtil" class="weaver.filter.XssUtil" scope="page" />
<%
//获取页面参数
String qname = Util.null2String(request.getParameter("flowTitle"));
String countryname= Util.null2String(request.getParameter("countryname"));
String countrydesc= Util.null2String(request.getParameter("countrydesc"));
%>
<HTML>
<HEAD>
<LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET><!--加载全局CSS-->
<SCRIPT language="javascript" src="/js/weaver_wev8.js"></script><!--引入所需要的js文件-->
<script language=javascript src="/js/ecology8/hrm/HrmSearchInit_wev8.js"></script>
<script type="text/javascript">
//页面上的JavaScript方法
function onBtnSearchClick(){
jQuery("#searchfrm").submit();
}
function doOpen(url,title,_dWidth,_dHeight){
if(dialog==null){
dialog = new window.top.Dialog();
}
dialog.currentWindow = window;
dialog.Title = title;
dialog.Width = _dWidth ? _dWidth : dWidth;
dialog.Height = _dHeight ? _dHeight : dHeight;
dialog.Drag = true;
dialog.maxiumnable = true;
dialog.URL = url;
dialog.show();
}
function showAllLog(){
var _sqlwhere = "<%=rs.getDBType().equals("db2")?"int(operateitem)":"operateitem"%>";
var url = "/systeminfo/SysMaintenanceLog.jsp?sqlwhere=where "+_sqlwhere+"=22";
doOpen(url,"<%=SystemEnv.getHtmlLabelName(83,user.getLanguage())%>",jQuery(window).width(),jQuery(window).height());
}
</script>
</head>
<BODY>
<!--引入右键菜单起始文件-->
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
if(HrmUserVarify.checkUserRight("HrmCountriesAdd:Add", user)){ //判断是否有对应的权限,有则显示该菜单
RCMenu += "{"+SystemEnv.getHtmlLabelName(82,user.getLanguage())+",javascript:doAdd();,_self} " ;
<!--标签显示菜单名,如 82 为新增 -->
RCMenuHeight += RCMenuHeightStep;
}
if(HrmUserVarify.checkUserRight("HrmCountriesEdit:Delete", user)){
RCMenu += "{"+SystemEnv.getHtmlLabelName(32136,user.getLanguage())+",javascript:doDel();,_self} " ;
RCMenuHeight += RCMenuHeightStep;
}
if(HrmUserVarify.checkUserRight("HrmCountries:Log", user)){
RCMenu += "{"+SystemEnv.getHtmlLabelName(83,user.getLanguage())+",javascript:showAllLog();,_self} " ;
RCMenuHeight += RCMenuHeightStep ;
}
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>
<!--引入右键菜单结束文件-->
<form action="" name="searchfrm" id="searchfrm"><!-- 页面上表单 -->
<!-- 页面上显示的按钮 -->
<table id="topTitle" cellpadding="0" cellspacing="0">
<tr>
<td></td>
<td class="rightSearchSpan" style="text-align:right;">
<%
if(HrmUserVarify.checkUserRight("HrmCountriesAdd:Add", user)){
%>
<input type=button class="e8_btn_top" onclick="doAdd();" value="<%=SystemEnv.getHtmlLabelName(82,user.getLanguage())%>"></input>
<%
}
if(HrmUserVarify.checkUserRight("HrmCountriesEdit:Delete", user)){
%>
<input type=button class="e8_btn_top" onclick="doDel();" value="<%=SystemEnv.getHtmlLabelName(32136, user.getLanguage())%>"></input>
<% } %>
<input type="text" class="searchInput" name="flowTitle" value="<%=qname%>"/>
<span id="advancedSearch" class="advancedSearch"><%=SystemEnv.getHtmlLabelName(21995,user.getLanguage())%></span><span title="<%=SystemEnv.getHtmlLabelName(23036,user.getLanguage())%>" class="cornerMenu"></span>
</td>
</tr>
</table>
<div class="advancedSearchDiv" id="advancedSearchDiv" style="display:none;" >
<!-- 系统布局组件 wea:layout wea:group wea:item -->
<wea:layout type="4col">
<wea:group context='<%=SystemEnv.getHtmlLabelName(20331,user.getLanguage())%>'>
<wea:item><%=SystemEnv.getHtmlLabelNames("377,399",user.getLanguage())%></wea:item>
<wea:item><input type="text" id="countryname" name="countryname" class="inputStyle" value='<%=countryname %>'></wea:item>
<wea:item><%=SystemEnv.getHtmlLabelNames("377,15767",user.getLanguage())%></wea:item>
<wea:item><input type="text" id="countrydesc" name="countrydesc" class="inputStyle" value='<%=countrydesc%>'></wea:item>
</wea:group>
<wea:group context="">
<wea:item type="toolbar">
<input type="button" value="<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%>" class="e8_btn_submit" onclick="onBtnSearchClick()"/>
<input type="button" value="<%=SystemEnv.getHtmlLabelName(2022,user.getLanguage())%>" class="e8_btn_cancel" onclick="resetCondtion();"/>
<input type="button" value="<%=SystemEnv.getHtmlLabelName(31129,user.getLanguage())%>" class="e8_btn_cancel" id="cancel"/>
</wea:item>
</wea:group>
</wea:layout>
</div>
</form>
<%
String _sql = "";
String backfields = " a.id,a.countryname,a.countrydesc,(case when a.canceled IS NULL then '0' else a.canceled end) as canceled,(case when b.result IS NULL then 0 else b.result end) as result ";
String fromSql = " from HrmCountry a left join ( select a.countryid,count(a.id) as result from HrmProvince a "+_sql+" group by a.countryid ) b on a.id = b.countryid ";
String sqlWhere = " where 1 = 1 ";
String orderby = " a.id " ;
String tableString = "";
if(qname.length() > 0){
sqlWhere += " and a.countryname like '%"+qname+"%'";
}
if(countryname.length() > 0){
sqlWhere += " and a.countryname like '%"+countryname+"%'";
}
if(countrydesc.length() > 0){
sqlWhere += " and a.countrydesc like '%"+countrydesc+"%'";
}
String operateString= "<operates width=\"20%\">";
operateString+=" <popedom transmethod=\"weaver.hrm.common.SplitPageTagOperate.getBasicOperate\" otherpara=\""+HrmUserVarify.checkUserRight("HrmCountriesEdit:Edit", user)+":+column:result+==0and"+HrmUserVarify.checkUserRight("HrmCountriesEdit:Delete", user)+":+column:canceled+==0and+column:result+==0and"+HrmUserVarify.checkUserRight("HrmCountriesEdit:Edit", user)+":+column:canceled+==1and"+HrmUserVarify.checkUserRight("HrmCountriesEdit:Edit", user)+":"+HrmUserVarify.checkUserRight("HrmCountriesEdit:log", user)+"\"></popedom> ";
operateString+=" <operate href=\"javascript:doEdit();\" text=\""+SystemEnv.getHtmlLabelName(93,user.getLanguage())+"\" index=\"0\"/>";
operateString+=" <operate href=\"javascript:doDel()\" text=\""+SystemEnv.getHtmlLabelName(91,user.getLanguage())+"\" index=\"1\"/>";
operateString+=" <operate href=\"javascript:doCanceled();\" text=\""+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+"\" index=\"2\"/>";
operateString+=" <operate href=\"javascript:doISCanceled();\" text=\""+SystemEnv.getHtmlLabelName(22152,user.getLanguage())+"\" index=\"3\"/>";
operateString+=" <operate href=\"javascript:doLog()\" text=\""+SystemEnv.getHtmlLabelName(83,user.getLanguage())+"\" index=\"4\"/>";
operateString+="</operates>";
tableString =" <table pageId=\""+Constants.HRM_Z_031+"\" pagesize=\""+PageIdConst.getPageSize(Constants.HRM_Z_031,user.getUID(),Constants.HRM)+"\" tabletype=\"checkbox\">"+
" <checkboxpopedom showmethod=\"weaver.hrm.common.SplitPageTagOperate.getBasicCheckbox\" id=\"checkbox\" popedompara=\"column:result+==0and"+HrmUserVarify.checkUserRight("HrmCountriesEdit:Delete", user)+"\" />"+
" <sql backfields=\""+backfields+"\" sqlform=\""+fromSql+"\" sqlwhere=\""+Util.toHtmlForSplitPage(sqlWhere)+"\" sqlorderby=\""+orderby+"\" sqlprimarykey=\"a.id\" sqlsortway=\"Asc\" sqlisdistinct=\"true\"/>"+
operateString+
" <head>"+
" <col width=\"25%\" text=\""+SystemEnv.getHtmlLabelNames("377,399",user.getLanguage())+"\" column=\"countryname\" orderkey=\"countryname\" />"+
" <col width=\"40%\" text=\""+SystemEnv.getHtmlLabelNames("377,15767",user.getLanguage())+"\" column=\"countrydesc\" orderkey=\"countrydesc\" />"+
" <col width=\"30%\" text=\""+SystemEnv.getHtmlLabelName(602,user.getLanguage())+"\" column=\"canceled\" orderkey=\"canceled\" transmethod=\"weaver.hrm.common.SplitPageTagFormat.colFormat\" otherpara=\"{cmd:style[1=color:red]}{cmd:array["+user.getLanguage()+";default=225,1=22205]}\"/>"+
" </head>"+
" </table>";
%>
<wea:SplitPageTag isShowTopInfo="false" tableString='<%=tableString%>' mode="run" />
<!-- 分页控件操作 -->
</BODY>
</HTML>
JAVA程序的基本组成
在e-cology中开发JAVA程序建议继承weaver.general.
BaseBean
,在BaseBean
中主要封装了两个方法:写日志文件,获取配置文件中的参数值。
writeLog(Object obj)
日志会输出到
weaver/ecology/log/ecology
中getPropValue(String fname , String key)
weaver.properties
中的DriverClasses
的值,代码如下:getPropValue(“weaver”,” DriverClasses”)